A few cleanups based on comments from Arjan van de Ven.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 22 Mar 2006 11:21:44 +0000 (12:21 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 22 Mar 2006 11:21:44 +0000 (12:21 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c

index 2f52c52a3357479b99f9f7e075fb02070ccb8e38..903532ff396fcfaaf52ee2d25393243b2fdb363f 100644 (file)
@@ -68,9 +68,6 @@
 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
 #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE)
 
-#ifndef __GFP_NOWARN
-#define __GFP_NOWARN 0
-#endif
 #define alloc_xen_skb(_l) __dev_alloc_skb((_l), GFP_ATOMIC|__GFP_NOWARN)
 
 #define init_skb_shinfo(_skb)                         \
index 89060dde9e4b41e714dbcc0a7c0c54e6b52635ef..84f35c884160dfb14130c7c300a3ac4913a3e903 100644 (file)
 
 extern struct mutex xenwatch_mutex;
 
-#define streq(a, b) (strcmp((a), (b)) == 0)
-
 static struct notifier_block *xenstore_chain;
 
 /* If something in array of ids matches this device, return it. */
 static const struct xenbus_device_id *
 match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev)
 {
-       for (; !streq(arr->devicetype, ""); arr++) {
-               if (streq(arr->devicetype, dev->devicetype))
+       for (; *arr->devicetype != '\0'; arr++) {
+               if (!strcmp(arr->devicetype, dev->devicetype))
                        return arr;
        }
        return NULL;
@@ -109,6 +107,23 @@ static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
 }
 
 
+static void free_otherend_details(struct xenbus_device *dev)
+{
+       kfree(dev->otherend);
+       dev->otherend = NULL;
+}
+
+
+static void free_otherend_watch(struct xenbus_device *dev)
+{
+       if (dev->otherend_watch.node) {
+               unregister_xenbus_watch(&dev->otherend_watch);
+               kfree(dev->otherend_watch.node);
+               dev->otherend_watch.node = NULL;
+       }
+}
+
+
 static int read_otherend_details(struct xenbus_device *xendev,
                                 char *id_node, char *path_node)
 {
@@ -126,8 +141,7 @@ static int read_otherend_details(struct xenbus_device *xendev,
            !xenbus_exists(XBT_NULL, xendev->otherend, "")) {
                xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s",
                                 xendev->nodename);
-               kfree(xendev->otherend);
-               xendev->otherend = NULL;
+               free_otherend_details(xendev);
                return -ENOENT;
        }
 
@@ -147,23 +161,6 @@ static int read_frontend_details(struct xenbus_device *xendev)
 }
 
 
-static void free_otherend_details(struct xenbus_device *dev)
-{
-       kfree(dev->otherend);
-       dev->otherend = NULL;
-}
-
-
-static void free_otherend_watch(struct xenbus_device *dev)
-{
-       if (dev->otherend_watch.node) {
-               unregister_xenbus_watch(&dev->otherend_watch);
-               kfree(dev->otherend_watch.node);
-               dev->otherend_watch.node = NULL;
-       }
-}
-
-
 /* Bus type for frontend drivers. */
 static int xenbus_probe_frontend(const char *type, const char *name);
 static struct xen_bus_type xenbus_frontend = {
@@ -438,7 +435,7 @@ static int cmp_dev(struct device *dev, void *data)
        struct xenbus_device *xendev = to_xenbus_device(dev);
        struct xb_find_info *info = data;
 
-       if (streq(xendev->nodename, info->nodename)) {
+       if (!strcmp(xendev->nodename, info->nodename)) {
                info->dev = xendev;
                get_device(dev);
                return 1;
@@ -490,15 +487,10 @@ static void xenbus_cleanup_devices(const char *path, struct bus_type *bus)
        } while (info.dev);
 }
 
-static void xenbus_dev_free(struct xenbus_device *xendev)
-{
-       kfree(xendev);
-}
-
 static void xenbus_dev_release(struct device *dev)
 {
        if (dev)
-               xenbus_dev_free(to_xenbus_device(dev));
+               kfree(to_xenbus_device(dev));
 }
 
 /* Simplified asprintf. */
@@ -587,7 +579,7 @@ static int xenbus_probe_node(struct xen_bus_type *bus,
 
        return 0;
 fail:
-       xenbus_dev_free(xendev);
+       kfree(xendev);
        return err;
 }
 
@@ -1022,10 +1014,6 @@ static int __init xenbus_probe_init(void)
                if (!page)
                        return -ENOMEM;
 
-               /* We don't refcnt properly, so set reserved on page.
-                * (this allocation is permanent) */
-               SetPageReserved(virt_to_page(page));
-
                xen_start_info->store_mfn =
                        pfn_to_mfn(virt_to_phys((void *)page) >>
                                   PAGE_SHIFT);
index 3016b81753a4c3db73c1082623585ac9df4d6ff6..7e343eff212e9456794e0ddfb54cdf66e633b56a 100644 (file)
@@ -48,8 +48,6 @@
 /* xenbus_probe.c */
 extern char *kasprintf(const char *fmt, ...);
 
-#define streq(a, b) (strcmp((a), (b)) == 0)
-
 struct xs_stored_msg {
        struct list_head list;
 
@@ -107,7 +105,7 @@ static int get_error(const char *errorstring)
 {
        unsigned int i;
 
-       for (i = 0; !streq(errorstring, xsd_errors[i].errstring); i++) {
+       for (i = 0; strcmp(errorstring, xsd_errors[i].errstring) != 0; i++) {
                if (i == ARRAY_SIZE(xsd_errors) - 1) {
                        printk(KERN_WARNING
                               "XENBUS xen store gave: unknown error %s",